package com.sudu.service.impl;

import com.sudu.dao.LikeDao;
import com.sudu.domain.Attention;
import com.sudu.domain.Favorite;
import com.sudu.service.likeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class likeServiceImpl implements likeService {

    @Autowired
    private LikeDao likeDao ;
    @Override
    public boolean saveFavorite(Favorite favorite) {
        return likeDao.saveFavorite(favorite) > 0;
    }

    @Override
    public boolean saveAttention(Attention attention) {
        return likeDao.saveAttention(attention) > 0;
    }

    @Override
    public boolean changeFavorite(int uid , int vid ,int newDelete) {
        return likeDao.changeFavorite(uid, vid ,newDelete) > 0;
    }

    @Override
    public boolean changeAttention(int uid , int likeId , int newDelete) {
        return likeDao.changeAttention(uid, likeId , newDelete) > 0;
    }

    @Override
    public Favorite IfFavorite(int uid, int vid) {
        return likeDao.IfFavorite(uid, vid) ;
    }

    @Override
    public Attention IfAttention(int uid, int likeId) {
        return likeDao.IfAttention(uid ,likeId) ;
    }

    @Override
    public int selectUidNum(int uid) {
        List<Integer> list = likeDao.selectUidNum(uid) ;
        return list.size();
    }

    @Override
    public int selectLikeIdNum(int uid) {
        List<Integer> list = likeDao.selectLikeIdNum(uid) ;
        return list.size();
    }

    @Override
    public int[] selectVidByUid(int uid) {
        return likeDao.selectVidByUid(uid);
    }
}
